package org.orzeszek.transfer;

import java.net.InetAddress;

/**
 * An ambassador for the settings in the application. There is one instance of
 * the {@link Settings} that is shared amongst classes.
 * 
 * @author Michael Gierasimiuk
 */
public interface Settings
{
  /**
   * Sets the port to use for incoming connections. The given value must be
   * between 0 and 65535. If the port is not explicitly specified, a default
   * port will be used instead.
   * 
   * @param port the port to use for incoming connections.
   */
  void setPort( int port );

  /**
   * Retrieves the port to use for incoming connections. This will either be a
   * default value or one that has been explicitly set by the user. Either way,
   * this method will return a valid port in the range of 0 to 65535.
   * 
   * @return the port to use for incoming connections.
   */
  int getPort();

  /**
   * Sets the {@link InetAddress} of the machine. If the address is not
   * explicitly set, the ambassador will attempt to find it automatically.
   * 
   * @param address the new Internet address to set.
   */
  void setAddress( InetAddress address );

  /**
   * Retrieves the machine's Internet address as an {@link InetAddress}. If an
   * address has been specifically set manually, it will be returned. Otherwise,
   * the ambassador will attempt to find the address automatically.
   * 
   * @return the machine's Internet address.
   */
  InetAddress getAddress();
}
